package com.bingfor.easycablelink.product;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.bingfor.easycablelink.R;
import com.bingfor.easycablelink.base.BaseActivity;
import com.bingfor.easycablelink.databinding.ActivityConfirmOrderBinding;
import com.bingfor.easycablelink.my.AddressListActivity;
import com.bingfor.easycablelink.my.InvoiceInformationActivity;
import com.github.lazylibrary.util.ViewAnimationUtils;

public class ConfirmOrderActivity extends BaseActivity {

    ActivityConfirmOrderBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityConfirmOrderBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        initToolbar();
    }

    @Override
    public void initViews() {
        binding.llChoicePayWay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                moveToNextPage(PaymentMethodActivity.class);
            }
        });
        binding.containerInvoice.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                moveToNextPage(InvoiceInformationActivity.class);
            }
        });
        binding.containerAddressChoice.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                moveToNextPage(AddressListActivity.class);
            }
        });
        binding.btnToPay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                moveToNextPage(PaymentResultsActivity.class);
            }
        });
        binding.llMore.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (binding.llProductDetail.isShown()){
                    ViewAnimationUtils.goneViewByAlpha(binding.llProductDetail,100);
                }else {
                    ViewAnimationUtils.visibleViewByAlpha(binding.llProductDetail);
                }
            }
        });

    }

    @Override
    public void initToolbar() {
        Toolbar toolbar = $(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        setTitle("确认订单");
        initViews();
    }

    @Override
    public void refresh() {

    }
}
